<?php

namespace Usuarios;

use Usuarios\Model\Usuario;
use Usuarios\Model\UsuarioTable;
use Usuarios\Model\Alumno;
use Usuarios\Model\AlumnoTable;
use Usuarios\Model\Profesor;
use Usuarios\Model\ProfesorTable;
use Usuarios\Model\Funcionario;
use Usuarios\Model\FuncionarioTable;

use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;

//use Zend\ModuleManager\Feature\AutoloaderProviderInterface;

//class Module implements AutoloaderProviderInterface {
class Module {

   public function getAutoloaderConfig() {
      return array(
         'Zend\Loader\ClassMapAutoloader' => array(
            __DIR__ . '/autoload_classmap.php',
         ), 
         'Zend\Loader\StandardAutoloader' => array(
            'namespaces' => array(
               __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
            ),
         ),
      );
   }

   public function getConfig() {
      return include __DIR__ . '/config/module.config.php';
   }

   public function getServiceConfig() {
      return array(
         'factories' => array(

            'Usuarios\Model\UsuarioTable' => function($sm) {
               //$tableGateway = $sm->get('UsuarioTableGateway');
               //$table = new UsuarioTable($tableGateway);
               $table = new UsuarioTable();
               return $table;
            },
            /*'UsuarioTableGateway' => function($sm) {
               $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
               $resultSetPrototype = new ResultSet();
               $resultSetPrototype->setArrayObjectPrototype(new Usuario());
               return new TableGateway('usuarios', $dbAdapter, null, $resultSetPrototype);
            },*/

            'Usuarios\Model\AlumnoTable' => function($sm) {
               //$tableGateway = $sm->get('AlumnoTableGateway');
               //$table = new AlumnoTable($tableGateway);
               $table = new AlumnoTable();
               return $table;
            },
            /*'AlumnoTableGateway' => function($sm) {
               $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
               $resultSetPrototype = new ResultSet();
               $resultSetPrototype->setArrayObjectPrototype(new Alumno());
               return new TableGateway('alumnos', $dbAdapter, null, $resultSetPrototype);
            },*/

            'Usuarios\Model\ProfesorTable' => function($sm) {
               //$tableGateway = $sm->get('ProfesorTableGateway');
               //$table = new ProfesorTable($tableGateway);
               $table = new ProfesorTable();
               return $table;
            },
            /*'ProfesorTableGateway' => function($sm) {
               $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
               $resultSetPrototype = new ResultSet();
               $resultSetPrototype->setArrayObjectPrototype(new Profesor());
               return new TableGateway('profesores', $dbAdapter, null, $resultSetPrototype);
            },*/

            'Usuarios\Model\FuncionarioTable' => function($sm) {
               //$tableGateway = $sm->get('FuncionarioTableGateway');
               //$table = new FuncionarioTable($tableGateway);
               $table = new FuncionarioTable();
               return $table;
            },
            /*'FuncionarioTableGateway' => function($sm) {
               $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
               $resultSetPrototype = new ResultSet();
               $resultSetPrototype->setArrayObjectPrototype(new Funcionario());
               return new TableGateway('funcionarios', $dbAdapter, null, $resultSetPrototype);
            },*/

         ),
      );
   }

}
